//
//  NETSTATUSCtl.m
//  afnleaks
//
//  Created by  Mac on 2021/3/31.
//

#import "NETSTATUSCtl.h"

@interface NETSTATUSCtl ()

@end

@implementation NETSTATUSCtl

- (void)viewDidLoad {
    [super viewDidLoad];
}


- (IBAction)netstatus:(id)sender {
    //1. 创建网络监测者
        AFNetworkReachabilityManager *manager = [AFNetworkReachabilityManager sharedManager];
        
        [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {
            //监测网络改变
            switch (status) {
                case AFNetworkReachabilityStatusUnknown:
                    NSLog(@"未知网络状态");
                    break;
                case AFNetworkReachabilityStatusNotReachable:
                    NSLog(@"无网络");
                    break;
                case AFNetworkReachabilityStatusReachableViaWWAN:
                    NSLog(@"蜂窝数据网络");
                    break;
                case AFNetworkReachabilityStatusReachableViaWiFi:
                    NSLog(@"WiFi网络");
                    break;
                    
                default:
                    break;
            }
        }];
}

@end
